var SWITCH_METHOD = 'http://software-site:70/php/test.php';
function ReadMoreCtrl($scope)
{

    var id  = window.location.search.split('=')[1];
    $scope.CurrId = id;
    var GetSomeProduct = function()
    {
        $scope.productSome = {};
        var id = $scope.CurrId;
        var data = {Id : id};
        $.post(SWITCH_METHOD, {method: 'GetCurrentProduct', data: data}, function (response) {
            $scope.productSome = JSON.parse(response);
            $scope.$apply();
           /* setTimeout(function(){

                var dataDown = {
                    Id : $scope.productSome[0].Id,
                    Download : $scope.productSome[0].Download
                };
                console.log(dataDown);
                window.location.href="http://software-site:70/download.php?id=" + $scope.productSome[0].Image;
                $.post(SWITCH_METHOD, {method: 'AddCountDownload', data: dataDown}, function (response) {

                });

            },1000);*/
        });
    };
    $scope.Links = {};
    var GetAllLinks = function(){
        $.post(SWITCH_METHOD,{method : 'GetLinks'}, function (response) {
            $scope.Links = JSON.parse(response);
            $scope.$apply();
             setTimeout(function(){
             window.location.href="http://software-site:70/download.php?link=" + $scope.Links[0].Link;


             },$scope.Links[0].Time);



        });
        console.log($scope.Links);
    };
    GetAllLinks();






    GetSomeProduct();
}

